package com.tongji.showroom.command
{ 
	import com.tongji.showroom.events.SearchSceneEvent;
	import com.tongji.showroom.events.ShowRoomEvent;
	import com.tongji.showroom.model.FurnitureModel;
	import com.tongji.showroom.model.GetSystemSceneModel;
	import com.tongji.showroom.model.SearchSceneModel;
	import com.tongji.showroom.service.GetSystemSceneService;
	import com.tongji.showroom.service.SearchSceneService;
	
	import org.robotlegs.mvcs.Command;
	
	/**
	 * 
	 * @author jiarong
	 * 
	 */
	public class SearchSceneCommand extends Command
	{
		[Inject]
		public var service:SearchSceneService; 
		
		[Inject]
		public var model:SearchSceneModel;
		
		[Inject]
		public var event:SearchSceneEvent;
		
		[Inject]
		public var furitureModel:FurnitureModel;
		
		[Inject]
		public var getSceneModel:GetSystemSceneModel;
		public function SearchSceneCommand()
		{
			super();
		}
		
		override public function execute():void
		{
			switch(event.type)
			{
				case SearchSceneEvent.SEARCH_ALL_SCENES:
					service.searchScene(event.userId,event.sceneId, event.styleId, event.currentPage, event.pageSize);
					break;
				case SearchSceneEvent.UPDATE_SCENES:
					getSceneModel.updateScene(event.scene);
					break;
				case SearchSceneEvent.DRAG_ROOM:
					furitureModel.getRoom(event.room);
					break;
					
			}
		}
	}
}